home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club - Holiday 1996 / Software of the Month Club - Holiday 1996.iso / pc / win / fgx / game_3.sx_ / game_3.sx
Text File  |  1996-06-30  |  683b  |  31 lines

  1. //////////////////////////
  2. // Harrow Software 1996
  3. // Colored ball definition
  4. //
  5.  
  6. message "Please execute game_1.sxt"
  7. return
  8.  
  9. initialize: my_sprite, my_bitmaps
  10.     // choose a random color
  11.     random_color = floor (rnd 3)
  12.     my_bitmap = my_bitmaps get random_color
  13.     $my_sprite.name = "colored ball"
  14.  
  15.     xpos = 0
  16.     ypos = 0
  17.     xvel = rnd 20 - 10    // random velocity
  18.     yvel = rnd 20 - 10
  19.  
  20. update_sprite:
  21.     xmid = my_bitmap.xlen/2        // get offset from center
  22.     ymid = my_bitmap.ylen/2
  23.  
  24.     sprite my_sprite bitmap my_bitmap at xpos-xmid, ypos-ymid depth ypos
  25.  
  26.     xpos = xpos + xvel    // move the ball
  27.     ypos = ypos + yvel
  28.  
  29.     // wrap the ball around the window
  30.     wrap xpos,ypos window
  31.